﻿<%@ Page Language="C#" AutoEventWireup="true" CodeFile="QuantityAddCourseInfo.aspx.cs"
    Inherits="CourseManagement_QuantityAddCourseInfo" %>
 
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title>批量添加课程信息</title>
    <link href="../Css/ys.css" rel="stylesheet" type="text/css" />
    <link href="../Css/auto.css" rel="stylesheet" type="text/css" />

    <script src="../Js/jquery-1.4.2.min.js" type="text/javascript"></script>
    <script src="../Js/jquery.json-2.2.min.js" type="text/javascript"></script>
        <script src="../Js/jquery.autocomplete.js" type="text/javascript"></script>
    <script src="../Js/Core.js" type="text/javascript"></script>

    <script src="../Js/Main.js" type="text/javascript"></script>

    <script language="javascript" type="text/javascript">
        function SetTrainingClassSelectedValue(source, eventArgs) {
            var targetControlId = source.get_element().id; //得到textbox的id
            var index = targetControlId.substring(17, targetControlId.length); //获取行号
            document.getElementById('txtTrainClassName' + index).value = eventArgs.get_text();
            document.getElementById('HidTrainClassID' + index).value = eventArgs.get_value();

        }
        function ChkDel(object) {
            var tabDetail = $("#list");
            var attendenceData = new Array();
            var trs = $("#list").find("tr");
           
            if (trs.length > 2) {
                $(object).parents('tr').remove();
                return;
            } else {
            alert("对不起，只剩最后一行不能删除了！");
            return;
            }
          //  $(object).parents('tr').remove()
        }


        $(document).ready(function() {
            var obj = $("#row").clone(true).appendTo("#list");
            obj.find("[DataField='TrainClassName']").attr({ id: "txtTrainClassName" + rond });
            obj.find("[DataField='TrainClassID']").attr({ id: "HidTrainClassID" + rond });
            obj.find("[DataField='VC_name']").attr({ id: "txtVC_name" + rond });
            obj.find("[DataField='VC_desc']").attr({ id: "txtVC_desc" + rond });
            obj.find("[DataField='Vc_content']").attr({ id: "txtcontent" + rond });
            obj.find("[DataField='Vc_targetUsers']").attr({ id: "txttargetUsers" + rond });
            $("#list").find("[DataField='rowhead']").attr({ id: "row" + rond });
            obj.show();
            // $("#row1").hide();

            $("#txtTrainClassName" + 1).autocomplete("../Handler/ClassComplete.ashx", {
                minChars: 0,
                formatItem: function(data, i, n) {
                    var array = data.toString().split(',');
                    return array[0];
                },
                formatResult: function(data, i, n) {
                    var array = data.toString().split(',');
                    return array[1];
                }

            }).result(function(event, data, formatted) {
                var array = data.toString().split(',');

                $("#HidTrainClassID" + event.currentTarget.id.substring(event.currentTarget.id.length - 1, event.currentTarget.id.length)).val(array[2]);
            });

        });
    </script>
 
</head>
<body>
    <form id="form1" runat="server">
    <div style="margin-left: 5px">
        <div class="title">
            批量录入课程信息</div>
        <table id="list" class="tab_alt" style="width: 85%" cellpadding="0" cellspacing="0">
            <tr  class="header">
                <%--   <td class="noWrapTD">序号</td>--%>
                <td class="noWrapTD">
                    隶属学校
                </td>
                <td class="noWrapTD">
                    培训班
                </td>
                <td class="noWrapTD">
                    课程名
                </td>
                <td class="noWrapTD">
                    课程特色
                </td>
                <td class="noWrapTD">
                    课程内容
                </td>
                <td class="noWrapTD">
                    适用人群
                </td>
                <td class="noWrapTD">
                    操作
                </td>
            </tr>
            
        </table>
        <table>
         <tr id="row" class="template"  DataField="rowhead" style="display:none">
                <td class="ta2">
                    <asp:TextBox ID="txtSchoolID" runat="server" Width="120px" CssClass="inp3" DataField="SchoolName"></asp:TextBox>
                  <input type="hidden" ID="HidSchoolID" runat="server" DataField="SchoolID"/>
                </td>
                <td class="ta2">
                    <asp:TextBox ID="txtTrainClassName" runat="server" CssClass="inp3" DataField="TrainClassName"  ></asp:TextBox>
                    <input type="hidden" ID="HidTrainClassID" runat="server" DataField="TrainClassID"/>
                </td>
                <td class="ta2">
                    <asp:TextBox ID="txtVC_name" runat="server" Width="120px" CssClass="inp3" DataField="VC_name"></asp:TextBox>
                </td>
                <td class="ta2">
                    <asp:TextBox ID="txtVC_desc" runat="server" Width="120px" CssClass="inp3" DataField="VC_desc"></asp:TextBox>
                </td>
                <td class="ta2">
                    <asp:TextBox ID="txtcontent" runat="server" Width="120px" CssClass="inp3" DataField="Vc_content"></asp:TextBox>
                </td>
                <td class="ta2">
                    <asp:TextBox ID="txttargetUsers" runat="server" Width="120px" CssClass="inp3" DataField="Vc_targetUsers"></asp:TextBox>
                </td>
                <td>
                    <a href="javascript:;" onclick="ChkDel(this);">删除</a>
                </td> 
            </tr>
        </table>
        <table>
        <tr>
                <td>
                    <input type="button" ID="btnAdd"   value="提交"  onclick="VideoNetSchool.Course.PostCourse();" class="button"/>
                     &nbsp;&nbsp;<input type="button" value="返回" onclick="window.history.go(-1)"
                        class="button" id="back" runat="server">&nbsp;&nbsp;<input type="button" value="增加" onclick="VideoNetSchool.Course.AddRow()"
                        class="button" id="Button1" >
                        
                </td>
            </tr>
        </table>
    </div>
    </form>
</body>
</html>
